<template>
  <div>
    <h2>欢迎光临垃圾收银系统水果店</h2>
    <h5>苹果 10￥ / 斤，折扣（8折）</h5>
    <p>请输入你要购买的斤数<input type="text" v-model="g" /></p>
    <button @click="fn">结账买单~</button>
    <p>结账单：总价：{{ a }}￥元 折后价：{{ b }}￥元 省了：{{c}}元</p>
  </div>
</template>

<script>
export default {
  data() {
    return {
      g: "",
      a: "",
      b: "",
      c: "",
    };
  },
  methods: {
    fn() {
      this.a = this.g * 10;
      this.b = this.g * 10 * 0.8;
      this.c = this.a - this.b;
    },
  },
};
</script>

<style scoped></style>
